﻿namespace VKTest.OAuth;

public class VkOAuthTest
{
    [Fact]
    public void TestGetAuthorizeUrl()
    {
        var oauth = new VkOAuth();
        var clientId = 1234567;
        var redirectUri = "https://example.com/vk";
        var display = VkOAuthDisplay.Page;
        var scope = new [] {VkOAuthUserScope.Wall, VkOAuthUserScope.Groups};
        var state = "secret_state_code";

        var browserUrl = oauth.GetAuthorizeUrl(VkOAuthResponseType.Code, clientId, redirectUri, display, scope, state);
        Assert.Equal("https://oauth.vk.com/authorize?client_id=1234567&redirect_uri=https%3A%2F%2Fexample.com%2Fvk&display=page&scope=270336&state=secret_state_code&response_type=code&v=5.101", browserUrl);
    }
        
    [Fact]
    public void TestGetAuthorizeUrl1()
    {
        var oauth = new VkOAuth();
        var clientId = 7853153;
        var redirectUri = "https://oauth.vk.com/blank.html";
        var display = VkOAuthDisplay.Page;
        var scope = new [] {VkOAuthUserScope.Wall, VkOAuthUserScope.Groups, VkOAuthUserScope.Offline};
        var state = "secret_state_code";

        var browserUrl = oauth.GetAuthorizeUrl(VkOAuthResponseType.Token, clientId, redirectUri, display, scope, state, revoke: true);
        Console.WriteLine(browserUrl);
        Assert.True(true);
    }
}